package com.meida.boot.handler.order;

import com.meida.common.mybatis.entity.EntityMap;
import com.meida.common.mybatis.interceptor.GetInterceptor;
import com.meida.common.mybatis.query.CriteriaQuery;
import com.meida.common.utils.FlymeUtils;
import com.meida.module.pay.client.enums.PayTypeEnum;
import com.meida.module.pay.provider.service.PayInfoService;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 订单详情
 *
 * @author zyf
 */
@Component("orderGetHandler")
@Log4j2
public class OrderGetHandler implements GetInterceptor {

    @Autowired
    private PayInfoService payInfoService;

    /**
     * 查询条件扩展
     *
     * @param cq
     * @return
     */
    @Override
    public void prepare(CriteriaQuery cq, EntityMap params) {

    }


    /**
     * 返回结果集扩展
     *
     * @param cq
     * @return
     */
    @Override
    public void complete(CriteriaQuery cq, EntityMap map) {
        String payType = map.get("payType");
        if (FlymeUtils.isNotEmpty(payType)) {
            map.put("payType", PayTypeEnum.valueOf(payType).getName());
        }
    }
}
